// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue";

import * as filters from "./filters";

import directives from "./directive";

import API from "./https/api";
import { encode, decode } from "./assets/js/base64.js";
import {
  hasThisButton,
  getdictName,
  ishasValue,
  alertFn,
  confirmFn,
  TimeTransform,
  recursion
} from "./assets/js/utils.js";

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});

Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key]);
});

//api
Vue.prototype.API = API;
//加解密
Vue.prototype.encode = encode;
Vue.prototype.decode = decode;
//按钮权限
Vue.prototype.hasButton = hasThisButton;
//获取字典
Vue.prototype.getdictName = getdictName;
//判断表格是否有值
Vue.prototype.ishasValue = ishasValue;
//成功错误信息
Vue.prototype.$alertFn = {
  success: msg => {
    alertFn(msg, true);
  },
  error: msg => {
    alertFn(msg, false);
  }
};
//确认框
Vue.prototype.$confirmFn = confirmFn;
//时间格式化
Vue.prototype.toTime = time =>
  time ? TimeTransform("YYYY-MM-DD hh:mm", time) : "--";
//递归获取数据
Vue.prototype.recursion = recursion;

const demoMenu = [
  //表格数据
  {
    id: "1",
    parentId: "-1",
    menuName: "系统管理",
    menuSort: "",
    menuAddr: "",
    menuKind: 0,
    menuStatus: 1,
    menuCode: "system",
    menuIcon: "system.png",
    creatTime: "2020-07-15 10:28",
    children: [
      {
        id: "11",
        parentId: "1",
        menuName: "用户管理",
        menuSort: "1",
        menuAddr: "/system/userManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:userManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "111",
            parentId: "11",
            menuName: "新增",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "112",
            parentId: "11",
            menuName: "模板下载",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:template",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "113",
            parentId: "11",
            menuName: "导入",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:import",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "114",
            parentId: "11",
            menuName: "导出",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:export",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "115",
            parentId: "11",
            menuName: "批量启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:batchStart",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "116",
            parentId: "11",
            menuName: "批量停用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:batchStop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "117",
            parentId: "11",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "118",
            parentId: "11",
            menuName: "密码重置",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:resize",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "119",
            parentId: "11",
            menuName: "分配角色",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:user",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1110",
            parentId: "11",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1111",
            parentId: "11",
            menuName: "停用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:stop",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "12",
        parentId: "1",
        menuName: "角色管理",
        menuSort: "2",
        menuAddr: "/system/roleManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:roleManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "121",
            parentId: "12",
            menuName: "新增",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "122",
            parentId: "12",
            menuName: "导出",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:export",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "123",
            parentId: "12",
            menuName: "批量启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:batchStart",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "124",
            parentId: "12",
            menuName: "批量停用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:batchStop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "125",
            parentId: "12",
            menuName: "批量删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:batchDel",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "126",
            parentId: "12",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "127",
            parentId: "12",
            menuName: "数据权限",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 0,
            menuCode: "system:roleManage:authority",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "128",
            parentId: "12",
            menuName: "分配用户",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:user",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "129",
            parentId: "12",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1210",
            parentId: "12",
            menuName: "停用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:stop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1211",
            parentId: "12",
            menuName: "删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:delete",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "13",
        parentId: "1",
        menuName: "菜单管理",
        menuSort: "3",
        menuAddr: "/system/menuManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:menuManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "131",
            parentId: "13",
            menuName: "新增",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "132",
            parentId: "13",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "133",
            parentId: "13",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "134",
            parentId: "13",
            menuName: "停用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:stop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "135",
            parentId: "13",
            menuName: "删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:delete",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "14",
        parentId: "1",
        menuName: "字典管理",
        menuSort: "4",
        menuAddr: "/system/dictManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:dictManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "141",
            parentId: "14",
            menuName: "新增",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "142",
            parentId: "14",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "143",
            parentId: "14",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "144",
            parentId: "14",
            menuName: "停用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:stop",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "15",
        parentId: "1",
        menuName: "日志管理",
        menuSort: "5",
        menuAddr: "/system/logManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:logManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "151",
            parentId: "15",
            menuName: "操作日志",
            menuSort: "51",
            menuAddr: "/system/logManage/operation",
            menuKind: 1,
            menuStatus: 1,
            menuCode: "system:logManage:operation",
            creatTime: "2020-07-15 10:28",
            children: [
              {
                id: "1511",
                parentId: "151",
                menuName: "批量删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:logManage:operation:batchDel",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1512",
                parentId: "151",
                menuName: "导出",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:logManage:operation:export",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1513",
                parentId: "151",
                menuName: "删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:logManage:operation:delete",
                creatTime: "2020-07-15 10:28"
              }
            ]
          },
          {
            id: "152",
            parentId: "15",
            menuName: "登录日志",
            menuSort: "52",
            menuAddr: "/system/logManage/login",
            menuKind: 1,
            menuStatus: 1,
            menuCode: "system:logManage:login",
            creatTime: "2020-07-15 10:28",
            children: [
              {
                id: "1521",
                parentId: "152",
                menuName: "批量删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:logManage:login:batchDel",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1522",
                parentId: "152",
                menuName: "导出",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:logManage:login:export",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1523",
                parentId: "152",
                menuName: "删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:logManage:login:delete",
                creatTime: "2020-07-15 10:28"
              }
            ]
          }
        ]
      }
    ]
  },
  {
    id: "2",
    parentId: "-1",
    menuName: "其他",
    menuSort: "",
    menuAddr: "",
    menuKind: 0,
    menuStatus: 0,
    menuCode: "",
    menuIcon: "other.png",
    creatTime: "2020-07-15 10:28",
    children: [
      {
        id: "21",
        parentId: "2",
        menuName: "其他",
        menuSort: "",
        menuAddr: "/",
        menuKind: 1,
        menuStatus: 0,
        menuCode: "",
        creatTime: "2020-07-15 10:28",
        children: []
      }
    ]
  }
];
// Vue.prototype.demoMenu = demoMenu;
